import { Button, Popconfirm, PopconfirmProps } from 'antd';
import { FC } from 'react';

type Props = Partial<PopconfirmProps> & {
  buttonText?: string;
};

const DeleteButton: FC<Props> = (props) => {
  return (
    <Popconfirm
      {...props}
      placement={props.placement || 'topRight'}
      title={props.title || '您确定要删除吗？'}
      okText={props.okText || '确认'}
      cancelText={props.cancelText || '取消'}
      overlayStyle={props.overlayStyle || { width: '266px' }}
      overlayInnerStyle={props.overlayInnerStyle || { width: '266px' }}
    >
      <Button key="remove" type="link" size="small">
        {props.buttonText || '删除'}
      </Button>
    </Popconfirm>
  );
};

export default DeleteButton;
